<template>
  <view class="category-box">
    <view v-if="isShowView">
    <uni-row>
      <uni-col :span="4">
        <image class="img" :src="category.icon"></image>
      </uni-col>
      <uni-col :span="17">
        <view class="title">{{category.name}}</view>
        <view class="des">{{category.description}}</view>
        <view class="thread_count">发帖数:{{category.thread_count}}</view>
      </uni-col>
      <uni-col :span="3">
        <qui-icon class="icon-each-follow " @click="gotoPage('shoppages/plus/signin/signin')"></qui-icon>
        <view class="font-sign"> 签到</view>
      </uni-col>
      <!--  <uni-col :span="3">
        <qui-button type="primary">发帖</qui-button>
      </uni-col> -->
    </uni-row>
   </view>
  </view>
</template>

<script>
  export default {
    data() {
      return {
        id: 0,
        category: {
          icon:'',
          name:'',
          description:'',
          thread_count:''
        },
        isShowView:true
      }
    },
    props: {
      searchIds: {
        type: Number,
        default: 0
      },
      admin:{
        type:Object,
        default:function(){
          return
        }
      }
    },
    watch: {
      searchIds: {
        immediate: true,
        handler: function(val) {
          this.loadData(val)
        }
      }
    },
    methods: {
      loadData(searchIds) {
        let self=this;
        const params = {
          id: searchIds,
        };
        this.$store
          .dispatch('jv/get', ['categorydetail', {params}])
          .then(res => {
            
            self.category = res._jv.json.Data;
            uni.setStorageSync("thread_id",self.category.id);
            uni.setStorageSync("thread_name",self.category.name);
            if(self.category.canEssenceThread)
            {
              self.$emit('admin')
            }
          }).catch(err => {
            console.log('err', err)
          })
        // ;
      }

    },
  }
</script>

<style>
  .category-box {
   margin:10rpx;

  }

  .img {
    float: left;
    width: 100rpx;
    height: 100rpx;
  }



  .title {
    font-size: 30rpx;
    font-weight: bold;
  }

  .des {
    font-size: 10px;
  }



  .font-sign {
    font-size: 10rpx;
  }

  .icon-each-follow {
    color: #23eb85;
  }

  .thread_count {
    clear: both;
    line-height: 30rpx;
    text-align: left;
    height: 30rpx;
    margin: 10rpx;
    margin-left: 20rpx;
    font-size: 20rpx;
  }

  .public_button {
    float: right;
  }
</style>
